import request from '@/utils/request'
// 使用枚举存储接口地址
enum Api {
    // 获取spu列表 
    getSpuListDataApi = '/admin/product/',
    // 增加spu的Api
    addSpuDataApi = '/admin/product/saveSpuInfo',
    // 删除spu的Api
    deleteSpuDataApi = '/admin/product/deleteSpu',
    // 更新spu的Api
    upDateSpuDataApi = '/admin/product/updateSpuInfo',
    // 获取所有trademark数据
    getTrademarkApi = '/admin/product/baseTrademark/getTrademarkList',
    // 获取所有销售属性\
    getBaseSaleAttrList='/admin/product/baseSaleAttrList'
}

// 获取spu列表
export const reqGetSpuListData = (page:number,limit:number,category3Id:number)=>{
    return request.get(Api.getSpuListDataApi+`${page}/${limit}?category3Id=${category3Id}`)
}

// 增加spu
export const reqAddSpuData = (spuInfo:object)=>{
    return request.post(Api.addSpuDataApi,spuInfo)
}

// 删除spu数据
export const reqDeleteSpuData = (spuId:number)=>{
    return request.delete(Api.deleteSpuDataApi+`/${spuId}`)
}

// 更新spu数据
export const reqUpdateSpuData = (spuInfo:object)=>{
    return request.post(Api.upDateSpuDataApi,spuInfo)
}

// 获取所有品牌数据
export const reqGetAllTrademarkData = ()=>{
    return request.get(Api.getTrademarkApi)
}

// 获取所有品牌的销售属性列表数据
export const reqGetBaseSaleAttrData = ()=>{
    return request.get(Api.getBaseSaleAttrList)
}